from renranapi.apps.article.models import Article
from django.utils import timezone as datetime
from mycelery.main import app
@app.task("check_article")
def check_article():
    article_list = Article.objects.filter(pub_date__lte=datetime.now())
    for article in article_list:
        article.is_public = True
        article.pub_date = None
        article.save()